package gameobjects;

import java.util.Random;

public class Dice {
	Random random;
	int value;
	ActionCube actionCube;
	/**
	 * Create a new dice. 
	 * @param cubetype The type of actioncube it represents
	 */
	public Dice(ActionCube cubetype){
		this.random = new Random();
		this.actionCube = cubetype;
	}
	
	/**
	 * Rolls the dice
	 * @return the outcome of the roll
	 */
	public int roll(){
		// nextInt(n) returns a random integer
		// between 0 (inclusive) and n (exclusive)
		// which in this case means we get an int ranging from 0 to 5.
		//We add 1 to get valid outcomes for a dice roll.
		this.value = this.random.nextInt(6) + 1;
		return value;
	}
	
	/**
	 * returns the last rolled value
	 * @return the value
	 */
	public int getValue(){
		return this.value;
	}
}
